﻿using AYQQMGR2018.Views.Shared;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;

namespace 小工具.Views.Shared.creator
{
    public abstract class BaseAyToolBoxExtraRightButtonCreator<T, V>
    {

        public abstract AyToolBoxExtraRightButton CreateBtn(V value);
        public abstract AyToolBoxExtraRightButton CreateBtn(T t);

        protected AyToolBoxExtraRightButton CreateBtn(V value, string Name, string path)
        {

            AyToolBoxExtraRightButton btn = new AyToolBoxExtraRightButton();
            btn.Content = Name;
            btn.Value = value;

            BitmapImage img = new BitmapImage(new Uri(path, UriKind.Relative));
            btn.Icon = img;

            return btn;
        }

        protected abstract V GetValue(T t);
    }
}
